export default function throttle(
  this: any,
  fn: (...rest: any) => void,
  gapTime = 1500
) {
  let enterTime = 0;
  return (...args: any) => {
    const backTime = new Date().getTime();
    if (backTime - enterTime > gapTime) {
      console.log(backTime - enterTime);
      fn.call(this, ...args);
      enterTime = backTime;
    }
  };
}
